FROM azul/zulu-openjdk-alpine:17-jre
ARG VERSION=2.2.0
ENV APP_NAME=irmp-base-service CFG_ENABLED=true CFG_NS=risk_dev VERSION=${VERSION} \
    CFG_SVR="4a41f7c0-63e2-469a-996f-19203eb0f09f.nacos.cn-east-3.cse.myhuaweicloud.com:8848" \
    EXT_OPTS="-Dfile.encoding=UTF-8 -Dspring.config.location=classpath:/conf/" \
    JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom" \
    MEM_OPTS="-Xms512m -Xmx1024m -Xss1024K -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m" \
    PORT=8080 TZ=Asia/Shanghai
EXPOSE 8080 9779 8778
COPY /jkube-generated-layer-final-artifact/maven /maven/
RUN addgroup -g 3000 riskctr && \
    adduser --disabled-password -u 1000 -G riskctr riskctr && \
    chown -R 1000:3000 /maven/ && \
    chmod -R g=u /maven/
ENTRYPOINT java $JAVA_OPTS $EXT_OPTS -Duser.timezone=$TZ \
    -Dserver.port=$PORT -Dspring.application.name=$APP_NAME \
    -Dspring.cloud.nacos.config.namespace=$CFG_NS \
    -Dspring.cloud.nacos.config.server-addr=$CFG_SVR \
    -Dspring.cloud.nacos.config.enabled=$CFG_ENABLED \
    -jar /maven/irmp-base-service-${VERSION}.jar
USER riskctr
